package pc29;

public class J16Ch05Printers {

	public static void main(String[] args) {
		
		

		J16Printer p = new J16Printer("애플", "애플프린터", "USB1");
		System.out.println(p.toString());

		J16InkjetPrinter ip = new J16InkjetPrinter("삼성", "삼성프린터", "USB2");
		System.out.println(ip.toString());

		J16LaserPrinter lp = new J16LaserPrinter("짭애플", "짭애플프린터", "USB3");
		System.out.println(lp.toString());
		
		

		J16PrintersService ps = new J16PrintersService();

		ps.print(p);


	}
}

class J16Printer {

	private String model;
	private String maker;
	private String interfaces;
	private int counts;
	private int remains;

	public J16Printer(String model, String maker, String interfaces) {

		this.model = model;
		this.maker = maker;
		this.interfaces = interfaces;

	}

	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}

	public String getMaker() {
		return maker;
	}

	public void setMaker(String maker) {
		this.maker = maker;
	}

	public String getInterfaces() {
		return interfaces;
	}

	public void setInterfaces(String interfaces) {
		this.interfaces = interfaces;
	}

	public int getCounts() {
		return counts;
	}

	public void setCounts(int counts) {
		this.counts = counts;
	}

	public int getRemains() {
		return remains;
	}

	public void setRemains(int remains) {
		this.remains = remains;
	}

	@Override
	public String toString() {
		String result = "";
		result += getModel() + " / " + getMaker() + " / " + getInterfaces()
				+ " / " + getCounts() + " / " + getRemains();
		return result;
	}

}

class J16InkjetPrinter extends J16Printer {

	// 부모클래스에 기본생성자가 정의되지 않았기 때문에
	// 자식클래스에서 따로 생성자를 정의해줘야 함

	public J16InkjetPrinter(String model, String maker, String interfaces) {
		super(model, maker, interfaces);
	}

}

class J16LaserPrinter extends J16Printer {

	public J16LaserPrinter(String model, String maker, String interfaces) {
		super(model, maker, interfaces);
	}

}

interface J16PrintersIService {

	void print(J16Printer a);

}

class J16PrintersService implements J16PrintersIService {
	public void print(J16Printer a) {
		String result = a.getModel() + "이"
				+ " 문서를 출력합니다";
		System.out.println(result);
	}

}
